/******************************************************************************
 *  Include Files
 *****************************************************************************/
#include "NVM.h"

/******************************************************************************
 *  Macro Definitions
 *****************************************************************************/

/******************************************************************************
 *  Const Definitions
 *****************************************************************************/

/*****************************************************************************
 *  Global Variables Definitions
 *****************************************************************************/
volatile uint32_t NVM_Checked_CHEKCSUM = 0;
volatile uint32_t NVM_CHEKCSUM_OK = 0;

/*****************************************************************************
 *  Local Function declarations
 *****************************************************************************/

/*****************************************************************************
 *  Function Definitions
 *****************************************************************************/
uint8_t NVM_Check_CheckSum(void) {
  uint16_t i;
  for (i = 0; i < CHECKSUM_ADDRESS; i += 4) {
    NVM_Checked_CHEKCSUM += *(uint32_t *)i;
  }

  if (*(uint32_t *)CHECKSUM_ADDRESS == NVM_Checked_CHEKCSUM) {
    NVM_CHEKCSUM_OK = 1;
  } else {
    NVM_CHEKCSUM_OK = 0;
  }
}
